Rewards Contract Spec (1)
Overview
The MultiTransfer contract facilitates the distribution of ETH to multiple recipient addresses in a single transaction. The admin role has the capability to initiate these transfers. Should a transfer fail, the contract accumulates the failed amount and ensures its return to the admin.
Data Model
Not Applicable
The contract does not use any custom data structures like structs.
Variables
DEFAULT_ADMIN_ROLE
A public constant bytes32 access control role provided by OpenZeppelin's AccessControl contract that identifies the admin of the contract.
Functions
constructor
Initializes the contract and assigns the DEFAULT_ADMIN_ROLE to the address deploying the contract.
multiTransfer
multiTransfer(address payable[] memory recipients, uint256[] memory amounts)
externalThis function accepts two arrays: recipient addresses and their corresponding ETH amounts. It attempts to transfer the specified ETH amounts to the provided addresses. If a transfer fails, the amount is accumulated for a refund to the admin.
withdraw
withdraw() externalAllows the admin to withdraw all accumulated ETH in the contract. Only callable by the admin.
receive (fallback function)
receive() external payableA fallback function that enables the contract to receive and hold ETH.
Getters
Not Applicable
There are no custom getter functions in the contract.
Setters
Not Applicable
There are no custom setter functions in the contract.
Events
Transfer
event Transfer(address indexed to, uint256 amount);Emitted when a transfer is successful.
TransferFailed
event TransferFailed(address indexed to, uint256 amount);Emitted when a transfer to an address fails.
Withdrawn
event Withdrawn(address indexed admin, uint256 amount);Emitted when the admin withdraws funds from the contract.